package com.fingard.dsp.bank.reqrespobj.invoicemsg;

import java.util.List;
import java.util.Map;

import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RequestBase;
import com.fingard.xml.XmlTextReader;

public class ReqInvoiceMsgQry extends RequestBase {
    //接入机构号
    public String CHANNEL_CODE="";
    //总笔数
    public String Z_BISHU="";
    //开票经销商名称
    public String BILLING_DEALER_NAME="";
    //启票经销商名称
    public String INVOICING_DEALER_NAME="";
    //订单编号
    public String ORDER_NO="";
    //发票代码
    public String INVOICE_NUMBER="";
    //VIN码
    public String BILLING_DATE="";
    //VIN码
    public String VIN_CODE="";
    //开票价格
    public String BILLING_PRICE="";
    //发票状态
    public String INVOICE_STATUS="";
    //车型代码
    public String MODEL_CODE="";
    //资金类型
    public String CASH_TYPE="";
    //预留字段1
    public String RESERVE1="";
    //预留字段2
    public String RESERVE2="";
    //预留字段3
    public String RESERVE3="";

    public String DealerCode="";
    public String DealerName ="";

    public List<Map<String, String>> listData;
    
    private XmlTextReader xmlReader;

    public ReqInvoiceMsgQry(XmlTextReader p_xmlReader, ReqRespHeader p_header) throws Exception {
    	reqHeader = p_header;
        xmlReader = p_xmlReader;
        //CHANNEL_CODE = xmlReader.getSimpleText("CHANNEL_CODE");
        Z_BISHU = xmlReader.getSimpleText("Z_BISHU");
        DealerCode = xmlReader.getSimpleText("DealerCode");
        DealerName = xmlReader.getSimpleText("DealerName");
        ORDER_NO =xmlReader.getSimpleTextNotNull("ORDERNO");
      /* BILLING_DEALER_NAME = xmlReader.getSimpleText("BILLING_DEALER_NAME");
        INVOICING_DEALER_NAME = xmlReader.getSimpleText("INVOICING_DEALER_NAME");
        ORDER_NO = xmlReader.getSimpleText("ORDER_NO");
        INVOICE_NUMBER = xmlReader.getSimpleText("INVOICE_NUMBER");
        BILLING_DATE = xmlReader.getSimpleText("BILLING_DATE");
        VIN_CODE = xmlReader.getSimpleText("VIN_CODE");
        BILLING_PRICE = xmlReader.getSimpleText("BILLING_PRICE");
        INVOICE_STATUS = xmlReader.getSimpleText("INVOICE_STATUS");
        RESERVE1 = xmlReader.getSimpleText("RESERVE1");
        RESERVE2 = xmlReader.getSimpleText("RESERVE2");
        RESERVE3 = xmlReader.getSimpleText("RESERVE3");
      //根据报文结构组装参数MAP
        listData = new ArrayList<Map<String, String>>();
        while(xmlReader.read(PATH_Detail)) {
        Map<String, String> map = new ConcurrentHashMap<String, String>();
        map.put("DATA_NO",""+i++);
        map.put("CASH_TYPE", xmlReader.readedXElement.getSingleText("CASH_TYPE"));   
        map.put("ORDER_NO", xmlReader.readedXElement.getSingleText("ORDER_NO"));
        map.put("BILLING_PRICE", xmlReader.readedXElement.getSingleText("BILLING_PRICE"));
        map.put("INVOICE_STATUS", xmlReader.readedXElement.getSingleText("INVOICE_STATUS"));
        map.put("VIN_CODE", xmlReader.readedXElement.getSingleText("VIN_CODE"));
        map.put("BILLING_DATE", xmlReader.readedXElement.getSingleText("BILLING_DATE"));
        map.put("INVOICE_NUMBER", xmlReader.readedXElement.getSingleText("INVOICE_NUMBER"));
        map.put("BILLING_DEALER_NAME", xmlReader.readedXElement.getSingleText("BILLING_DEALER_NAME"));       
        listData.add(map);
        }*/
    }
    
    public ReqInvoiceMsgQryDetail reqInvoiceMsgDetail;
    public boolean readRecord() throws Exception{
    	reqInvoiceMsgDetail = null;
        if(xmlReader.read(PATH_Detail)){
        	reqInvoiceMsgDetail = new ReqInvoiceMsgQryDetail(xmlReader.readedXElement, reqHeader.transType,reqHeader.bankCode);
            return true;
        }
        else{
            return false;
        }
    }
}

